class User < ActiveRecord::Base
  
  acts_as_authentic
  
  validates_presence_of :firstname, :lastname, :gpn, :username
  
  has_many :jurisdictionMembers
  
  def is_responsible_for role, jurisdiction
    jurisdictionMembers.select{|jm| jm.jurisdiction == jurisdiction &&
                                    jm.role == role}.first
  end
  
end
